import { Code, Desc, Entity, Jsonb, PrimaryUuid, Title, Uuid } from "@sker/core";
import { Unique } from "typeorm";

@Entity({
    name: 'core_component'
})
export class CoreComponent {

    @PrimaryUuid({
        primaryKeyConstraintName: 'PK_CORE_COMPONENT_ID'
    })
    id: string;

    @Jsonb({ comment: '输入' })
    input: any;

    @Jsonb({ comment: '输出' })
    output: any;

}

@Entity({
    name: 'core_page'
})
export class CorePage {
    @PrimaryUuid()
    id: string;

    @Code({
        comment: '页面类型'
    })
    type: string;

    @Code({
        comment: '页面代号(唯一)',
        unique: true,
    })
    name: string;

    @Title({
        comment: '页面标题',
        default: ''
    })
    title: string;

    @Desc({
        comment: '简介',
        default: ''
    })
    desc: string;

    @Jsonb({
        comment: '包含组件',
        default: [],
        nullable: true
    })
    children: CoreComponent[];

}
